package cn.edu.scau.cmi.xuminbang.comprehensive;
import java.io.*;
import java.util.Scanner;
public class ReadIn {
	public ReadIn() {
		
	}
	public ScoreOfCalss readIn(){
		ScoreOfCalss readmassage;
		String string = "000.txt";
		String [] temp = new String [250];
		for(int i=0;i<250;i++) {
			temp[i]="0";
		}
	    File file = new File(string);
		Scanner scanner = null;
		int i=0;
		try {
			scanner = new Scanner(file);
			scanner.useDelimiter("[\\s]+");
			while (scanner.hasNext()) {
				temp[i] = scanner.next();
				i++;
			}
		}
		catch (Exception e) {
			// TODO: handle exception
		}
		int flag = i;
		int flag2 = (flag-3)/7;
		String [][]string2= new String [flag2][7];
		for(int b=0;b<flag2;b++) {
			for(int j=0;j<7;j++) {
				string2 [b][j]="0";
			}
		}
		int p = 3;
		for(int a=0;a<flag2;a++) {
			for(int j=0;j<6;j++) {
				if(p<flag) {
					string2[a][j]=temp[p];
					p++;
				}
			}
		}
		for(int k=0;k<flag2;k++) {
			int n=(Integer.parseInt(string2[k][2])+Integer.parseInt(string2[k][3])+Integer.parseInt(string2[k][4])+Integer.parseInt(string2[k][5]));
			string2[k][6] = String.valueOf(n);
		}
		readmassage = new ScoreOfCalss(temp[0], temp[1], temp[2], string2);
		return readmassage;
	}

}
